home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995…tember: Reference Library / Dev.CD Sep 95 RL / Dev.CD Sep 95 RL.toast / mac / Technical Documentation / develop / develop Issue 23 code / Documentary Synchronicity ƒ / Source ƒ / HasRequiredFeatures.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-06  |  1.5 KB  |  59 lines  |  [TEXT/KAHL]

  1. /* 4567890123456789012345678901234567890123456789012345678901234567 */
  2. #include <Gestalt.h>
  3.  
  4. #include "Toolbox.h"
  5. #include "HasRequiredFeatures.h"
  6.  
  7. static Boolean IsSystemSeven(void);
  8.  
  9. Boolean HasRequiredFeatures(void) {
  10.     Boolean hasRequiredFeatures;
  11.     
  12.     if (HasFeature(gestaltAppleEventsAttr, gestaltAppleEventsPresent) &&
  13.         HasFeature(gestaltFSAttr, gestaltHasFSSpecCalls) &&
  14.         HasFeature(gestaltNotificationMgrAttr, 
  15.             gestaltNotificationPresent) &&
  16.         HasFeature(gestaltPopupAttr, gestaltPopupPresent) &&
  17.         HasFeature(gestaltFindFolderAttr, gestaltFindFolderPresent) &&
  18.         HasFeature(gestaltAliasMgrAttr, gestaltAliasMgrPresent) &&
  19.         IsSystemSeven()) {
  20.         hasRequiredFeatures = true;
  21.     } else {
  22.         hasRequiredFeatures = false;
  23.     }
  24.     return hasRequiredFeatures;
  25. }
  26.  
  27. Boolean IsSystemSeven(void) {
  28.     long         theResponse;
  29.     OSErr     theError;
  30.     Boolean    isSystemSeven;
  31.     short        theSystemVersion;
  32.  
  33.     theError = Gestalt(gestaltSystemVersion, &theResponse);
  34.     if (theError == noErr) {
  35.         theSystemVersion = (theResponse & 0xFF00) >> 8;
  36.         if (theSystemVersion == 0x07) {
  37.             /* 
  38.              * System 7.x.x
  39.              */
  40.             isSystemSeven = true;
  41.         } else {
  42.             /* 
  43.              * Some future System (probably Copland) is System 8.x.x
  44.              * Some of our code will need to be revisited in Copland.
  45.              * This is a sure way to see to it that we do. When the
  46.              * code stops working, our unhappy customers will surely
  47.              * tell us to fix it!
  48.              */
  49.             isSystemSeven = false;
  50.         }
  51.     } else {
  52.         /*
  53.          * An error occurred.
  54.          */
  55.         isSystemSeven = false;
  56.     }
  57.     return isSystemSeven;
  58. }
  59.